package com.xbongbong.paas.model;

import com.xbongbong.paas.domain.entity.BusinessRuleInfoEntity;
import com.xbongbong.paas.toolbox.wrap.IModel;

import java.util.List;
import java.util.Map;

/**
 * PAAS 业务规则服务层
 *
 * @author 吴峰
 * @date 2020/6/9 19:55
 */
public interface BusinessRuleInfoModel extends IModel<BusinessRuleInfoEntity> {

    /**
     * 插入实体
     *
     * @param entity 实体
     *
     * @return Integer MyBatis操作结果 1：成功
     */
    @Override
    Integer insert(BusinessRuleInfoEntity entity);

    @Override
    List<BusinessRuleInfoEntity> findEntitys(Map<String, Object> param);

    Integer delete(String corpid, Long id);

    /**
     * 批量删除
     * @param list 主键id集合
     * @param corpid
     * @author xingxing.xiao
     */
    Integer deleteBatch(List<Long> list, String corpid);
    /**
     * 批量更新
     * @param list
     * @param corpid
     */
    void updateBatch(List<BusinessRuleInfoEntity> list, String corpid);

    List<BusinessRuleInfoEntity> getByFormId(Long formId, String corpid, Integer businessType);

    Integer countByFormId(Long formId, String corpid, Integer businessType);

    /**
     * 批量插入实体
     * @param list
     * @return 返回数据的列表
     */
    List<BusinessRuleInfoEntity> insertBatch(List<BusinessRuleInfoEntity> list);

    /**
     * 更新优先级
     * @param businessRuleInfoList
     * @param corpid
     * @return
     */
    Integer updatePriority(List<BusinessRuleInfoEntity> businessRuleInfoList, String corpid);

    Integer updateEnable(Long id, Integer activeEnable, Integer inactiveEnable, String corpid);

    /**
     * 删除业务规则
     * @param formId 表单id
     * @param businessType 业务类型
     * @param corpid 公司id
     * @return
     */
    Integer deleteByForm(Long formId, Integer businessType, String corpid);
}
